package com.sgcc.statistics.config;

import com.sgcc.statistics.service.IOIndexBreakdownService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * Created by jingq on 2021/5/29.
 */
@Component
public class IndexBreakDownTask {
    private Logger logger = LoggerFactory.getLogger(IndexBreakDownTask.class);

    @Autowired
    private IOIndexBreakdownService ioIndexBreakdownService;

    // 每月初统计各区县的指标完成情况
    @Scheduled(cron = "0 10 0 1 * ?")
//    @Scheduled(cron = "0 0/2 * * * ?")
    public void execute() throws IOException {
        logger.info("-----------每月初统计各区县的指标完成情况---------");
        ioIndexBreakdownService.countLastMonthIndexCompletion();
    }
}
